using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Itdavany.Utility;
using Itdavany.Objects;


namespace Itdavany.Objects
{

    public class TexturePanel : Widget
    {
        Texture2D texture;

        bool verticalflip;
        public bool VerticalFlip
        {
            get { return verticalflip; }
            set { verticalflip = value; }
        }

        bool horizontalflip;
        public bool HorizontalFlip
        {
            get { return horizontalflip; }
            set { horizontalflip = value; }
        }


        public TexturePanel(string path)
        {
            texture = Shared.ContentManager.Load<Texture2D>(path);
            Width = texture.Width;
            Height = texture.Height;
        }

        public override void Draw()
        {
            if (!IsHidden)
            {
                DefaultSpriteBatch.Begin();
                DefaultSpriteBatch.Draw(texture, AreaRect, null, Color.White, 0.0f, Vector2.Zero,
                    ((horizontalflip)?SpriteEffects.FlipHorizontally : SpriteEffects.None)
                        | ((verticalflip)?SpriteEffects.FlipVertically : SpriteEffects.None), 0);
                DefaultSpriteBatch.End();
            }
            base.Draw();
        }
    }
}